<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layuiAdmin 网站用户 iframe 框</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
  <script src="../../../layuiadmin/jquery.min.js"></script>
  <script src="../../../layuiadmin/layui/layui.js"></script>
</head>
<body>
<form class="layui-form" action="">
  <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
    <div class="layui-form-item">
      <label class="layui-form-label">答案</label>
      <div class="layui-input-block">
        <input type="radio" name="flag" value="0" lay-filter="erweima"  title="{:$act['btn_0']}" checked="">
        <input type="radio" name="flag" value="1" lay-filter="erweima"  title="{:$act['btn_1']}">
      </div>
    </div>
  </div>
  <input type="hidden" id="flag"  value="0" >
</form>


</body>
<script>



    layui.use('form', function(){
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

        //……

        form.on('radio(erweima)', function (data) {
            //alert(data.elem);
            //console.log(data.elem);
            var abc=data.value;
            if(abc==1){
                $("#flag").val(1);
                // alert($("#zjidian").val());
            }else{
                $("#flag").val(0);
                //  alert($("#rjidian").val());
            }


        });
        //但是，如果你的HTML是动态生成的，自动渲染就会失效
        //因此你需要在相应的地方，执行下述方法来手动渲染，跟这类似的还有 element.init();
        form.render();
    });
</script>
</html>